#include <stdio.h>
#include <stdlib.h>
//给出一个不多于5位的整数，要求 1、求出它是几位数 2、分别输出每一位数字 3、按逆序输出各位数字，例如原数为321,应输出123
int cou(int n1,int count1)
{
	while(n1!=0)
	{
		n1=n1/10;
		count1++;
	}
	return count1;
}
int main()
{
	int n;
	int count=0;
	scanf("%d",&n);
	count=cou(n,count);
	while(1)
	{
		if(count>5)
		printf("输入错误，请重新输入");
		else
		break;	
	}
	printf("%d\n",count);
	//1
	int w=n%10;
	int q=n%100/10;
	int b=n%1000/100;
	int s=n%10000/1000;
	int g=n%100000/10000;
	char ch[5];
	ch[0]=g;
	ch[1]=s;
	ch[2]=b;
	ch[3]=q;
	ch[4]=w;
	for(int i=0;i<count;i++)
	{
		printf("%d ",ch[i]);
	}
	printf("\n");
	//2
	int temp;
	for(int x=0;x<count-1;x++)
	{
		for(int y=0;y<count-1;y++)
			{
			if(ch[y]<ch[y+1])
			{
				temp=ch[y+1];
				ch[y+1]=ch[y];
				ch[y]=temp;	
			}
		}
	}
	for(int j=0;j<count;j++)
	{
		printf("%d",ch[j]);
	}
	return 0;
}

